import React, {Component} from 'react';
import QueueAnim from 'rc-queue-anim';
import {WhiteSpace} from 'antd-mobile';

import Joblist from "./JobList/Joblist";
import {reqJoblist} from './../api';
import avatars from "../assets/js/avatar";
const JobItem = Joblist.Item;

export default class Job extends Component {
    constructor(props) {
        super(props);

        this.state = {
            isLoading: false,
            _data:[]
        };

    }
    async componentDidMount() {

        let {data:{data}} = await reqJoblist('');
        this.setState({_data:data})

    }

    render() {
        let {_data} = this.state;
        let src = 'https://img.bosszhipin.com/boss/avatar/avatar_14.png?x-oss-process=image/resize,w_100,limit_0'
        return (
            <div>
                <Joblist>
                    <QueueAnim type="alpha" delay={300}>
                {
                    _data.map(d=>(

                    <JobItem key={d._id} data={{
                        job: d.job,
                        salary: d.salary,
                        tags:[d.jingyan].concat(d.skill),
                        company: {
                            name: d.user.company,
                            info: d.user.rongzi,
                            num: d.user.guimo,
                            addr: d.user.companyAddr
                        },
                        user:{
                            avatar: avatars[`avatar_${d.user.avatar}`],
                            name: d.user.nickname,
                            job: d.user.bossJob,
                        }
                    }}/>

                    ))
                }
                    </QueueAnim>
                </Joblist>

            </div>
        )
    }
}